package com.changgou.order.controller;

import com.changgou.entity.Result;
import com.changgou.entity.StatusCode;
import com.changgou.user.feign.UserFeign;
import com.changgou.user.pojo.Address;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Map;

/**
 * UserController  TODO
 * 13418  computer
 *
 * @author zhougang
 * @date 2020/4/26 20:12
 */
@Controller
@RequestMapping("/wuser")
public class UserController {

    @Autowired
    private UserFeign userFeign;

    @GetMapping("/findAllArea")
    @ResponseBody
    public Result findAllArea() {
        Result result = userFeign.findAllArea();
        return result;
    }

    @RequestMapping("/address/list")
    public String list(Model model) {
        Result<List<Address>> result = userFeign.list();
        List<Address> addressList = result.getData();

        model.addAttribute("addressList", addressList);
        return "center-setting-address";
    }

    @RequestMapping("/info")
    public String info() {
        return "center-setting-info";
    }

    @RequestMapping("/password")
    public String password() {
        return "center-setting-safe";
    }

    @RequestMapping("/phone")
    public String phone() {
        return "center-setting-address-phone";
    }

    @RequestMapping("/complete")
    public String complete() {
        return "center-setting-address-complete";
    }

}
